package merchant.space;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.widget.ImageView;
import android.widget.TextView;

public class MyViewItemActivity extends Activity {

	
	private MyViewItemActivity context;
	private Item item;
	
	public void onCreate(Bundle savedInstanceState) {
		  super.onCreate(savedInstanceState);
		  Log.d("!!!","?!?!?!?!?!");
		  context=this;
		  
		  
		  item=DataLink.getMyItem();
		  if(item==null)
		  Log.d("!!!","?!?!?!?!?!");
		  setContentView(R.layout.viewitem);


		  
		  TextView title = (TextView) findViewById(R.id.title);
		  title.setText(item.getTitle());
		  
		  ImageView image = (ImageView) findViewById(R.id.image);
		  
		   image.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
		   image.setAdjustViewBounds(true);

		  
		  
		  image.setImageBitmap(item.getPhoto());
		
		  ImageView tradeicon = (ImageView) findViewById(R.id.tradeable_icon);
		  ImageView selicon = (ImageView) findViewById(R.id.sellable_icon);
		  
		  TextView tradlab = (TextView) findViewById(R.id.tradeable_label);
		  TextView selab = (TextView) findViewById(R.id.sellable_label);
		  
		  if (item.isTradeable())
		  {
			  tradeicon.setImageResource(R.drawable.green_hand);
			  tradlab.setText("Tradeable");
		  }
		  
		  else
		  {
			  tradeicon.setImageResource(R.drawable.red_hand);
			  tradlab.setText("Not Tradeable");
		  }
		  
		  if (item.isSeleable())
		  {
			  selicon.setImageResource(R.drawable.greendollar);
			  selab.setText("Sellable");
		  }
		  
		  else
		  {
			  selicon.setImageResource(R.drawable.dollar);
			  selab.setText("Not Sellable");
		  }
		  
		  TextView desc = (TextView)findViewById(R.id.description);
		  desc.setText(item.getDescription());
		 

}
	@Override
    public void onResume() {
    	//super.onResume();
	 super.onResume();
    	
    	Log.d("RESUMING","MYVIEWCOLLECTION");
    	MyCollectionsGroupActivity parent = (MyCollectionsGroupActivity) getParent();
    	if (parent.getNavigation().myCollectionsRefresh()==true)
    		finish();
    }
	
}